// 质检管理相关类型定义

// 异常投递记录
export interface QualityException {
  id: number
  userId: number
  userName: string
  userPhone: string
  deviceId: number
  deviceName: string
  deviceCode: string
  bagNumber?: string
  type: 'weight_error' | 'type_error' | 'amount_error' | 'other'
  wasteType: string
  weight: number
  originalAmount: number
  adjustAmount?: number
  description: string
  status: 'pending' | 'processing' | 'completed' | 'ignored'
  inspectorId?: number
  inspectorName?: string
  createdAt: string
  updatedAt: string
  images?: string[]
}

// 质检记录
export interface QualityRecord {
  id: number
  exceptionId: number
  inspectorId: number
  inspectorName: string
  actionType: 'approve' | 'adjust' | 'deduct' | 'compensate' | 'reject'
  originalAmount: number
  adjustAmount: number
  finalAmount: number
  reason: string
  inspectorNote?: string
  status: 'completed' | 'cancelled'
  createdAt: string
}

// 扣款记录
export interface QualityDeduction {
  id: number
  userId: number
  userName: string
  userPhone: string
  exceptionId?: number
  amount: number
  reason: string
  status: 'pending' | 'completed' | 'failed'
  operatorId: number
  operatorName: string
  createdAt: string
}

// 补款记录
export interface QualityAddition {
  id: number
  userId: number
  userName: string
  userPhone: string
  exceptionId?: number
  amount: number
  reason: string
  status: 'pending' | 'completed' | 'failed'
  operatorId: number
  operatorName: string
  createdAt: string
}

// 用户投递记录（用于新增异常时选择）
export interface UserDeliveryRecord {
  id: number
  userId: number
  userName: string
  userPhone: string
  deviceId: number
  deviceName: string
  deviceCode: string
  bagNumber: string
  wasteType: string
  weight: number
  amount: number
  deliveryTime: string
  images?: string[]
}

// 新增异常表单数据
export interface CreateExceptionForm {
  deliveryRecordId: number
  type: 'weight_error' | 'type_error' | 'amount_error' | 'other'
  description: string
  adjustAmount: number
  reason: string
}

// 质检统计
export interface QualityStats {
  totalExceptions: number
  pendingExceptions: number
  processedExceptions: number
  totalDeductions: number
  totalAdditions: number
  avgProcessTime: number
}
